package com.qf.order.insert.service.test;

import com.qf.order.insert.service.OrderInsertServiceApplication;

import com.qf.order.insert.service.beans.Orders;
import com.qf.order.insert.service.beans.Person;
import com.qf.order.insert.service.dao.OrderDAO;
import com.qf.order.insert.service.dao.PersonDAO;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;

/**
 * 测试orderdao类
 *
 * 作者：罗小宇
 * 日期：2020/7/3
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes = OrderInsertServiceApplication.class)
public class test {
    @Resource
    private OrderDAO orderDAO;
    @Resource
    private PersonDAO personDAO;
    /**
     * 测试order insert方法
     */
    //order_id,user_id,room_id,count,price,pers  on_id,start_time,end_time,ownerId
    @Test
    public void test(){
        Orders order = new Orders("12345",1,1,0,0,5,123.58,2,"2020-01-05","2020-01-08",1);
        orderDAO.insertOrder(order);
    }

    /**
     * 测试Person insert方法
     */
    @Test
    public void test1(){
        Person person = new Person(null,"王八蛋","4121564686746145341",null);
        personDAO.insertPerson(person);
        System.out.println(person.getPersonId());
    }
}
